package com.itheima.config;

import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author ghy
 * @version 1.0
 * @since 2025-08-04 10:08
 */
@Configuration
public class MpConfig {

    @Bean
    public MybatisPlusInterceptor mybatisPlusInterceptor() {
        MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
        PaginationInnerInterceptor paginationInnerInterceptor = new PaginationInnerInterceptor();
        paginationInnerInterceptor.setMaxLimit(1000L);   // 设置单页最大数量
        // paginationInnerInterceptor.setDbType(DbType.MYSQL);
        // paginationInnerInterceptor.setDialect(new MySqlDialect());   //方言  limit
        interceptor.addInnerInterceptor(paginationInnerInterceptor);
        return interceptor;
    }

}
